package mxmf.content.meta;

import mxmf.content.ContentHandler;
import mxmf.content.code.CodeGenerater;
import mxmf.entity.content.Content;
import mxmf.repository.BaseRepository;

public class ContentMetaContext<T extends Content> {

    private ContentMeta contentMeta;
    private ContentHandler<T> contentHandler;

    private BaseRepository<T, Long> contentRepository;

    private Class<?> t;

    private CodeGenerater codeGenerater;

    public ContentMetaContext(Class<?> t, ContentMeta contentMeta, ContentHandler<T> contentHandler,
            CodeGenerater codeGenerater, BaseRepository<T, Long> contentRepository) {
        super();
        this.t = t;
        this.contentMeta = contentMeta;
        this.contentHandler = contentHandler;
        this.codeGenerater = codeGenerater;
        this.contentRepository = contentRepository;
    }

    public Content createInstance() throws ReflectiveOperationException {
        return (Content) t.newInstance();
    }

    /**
     * @return the contentMeta
     */
    public ContentMeta getContentMeta() {
        return contentMeta;
    }

    /**
     * @param contentMeta the contentMeta to set
     */
    public void setContentMeta(ContentMeta contentMeta) {
        this.contentMeta = contentMeta;
    }

    /**
     * @return the contentHandler
     */
    public ContentHandler<T> getContentHandler() {
        return contentHandler;
    }

    /**
     * @param contentHandler the contentHandler to set
     */
    public void setContentHandler(ContentHandler<T> contentHandler) {
        this.contentHandler = contentHandler;
    }

    /**
     * @return the codeGenerater
     */
    public CodeGenerater getCodeGenerater() {
        return codeGenerater;
    }

    /**
     * @param codeGenerater the codeGenerater to set
     */
    public void setCodeGenerater(CodeGenerater codeGenerater) {
        this.codeGenerater = codeGenerater;
    }

    /**
     * @return the t
     */
    public Class<?> getT() {
        return t;
    }

    /**
     * @param t the t to set
     */
    public void setT(Class<?> t) {
        this.t = t;
    }

    /**
     * @return the contentRepository
     */
    public BaseRepository<T, Long> getJpaRepository() {
        return contentRepository;
    }

    /**
     * @param contentRepository the contentRepository to set
     */
    public void setJpaRepository(BaseRepository<T, Long> contentRepository) {
        this.contentRepository = contentRepository;
    }

}
